import java.util.Scanner;


public class ReverseWords2 {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.print(reverse(scanner.nextLine()));
  }

  private static String reverse(String words) {
    StringBuilder result = new StringBuilder();
    StringBuilder buffer = new StringBuilder();

    for (int i = 0; i < words.length(); i++) {
      char letter = words.charAt(i);
      if (letter != ' ') {
        buffer.append(letter);
      } else {
        result.append(buffer.reverse().toString());
        buffer.setLength(0);
        result.append(letter);
      }
    }

    result.append(buffer.reverse().toString());
    return result.toString();
  }

}
